package org.swing;

import java.awt.*;
import java.awt.event.WindowEvent;

/**
 * <p>Interface that is used for components which support window-specific modality. </p>
 */
public interface InputBlocker {
    /**
     * <p>Set status for modal component to busy or not and thus blocked or unblocked. </p>
     *
     * @param busy           modal status.
     * @param blockingWindow child window/frame that blocks owner.
     */
    public void setBusy(boolean busy, Window blockingWindow);


    /**
     * <p>Set status for modal component to busy or not and thus blocked or unblocked. </p>
     *
     * @param busy           modal status.
     * @param blockingIFrame child internal frame that blocks owner.
     */
    public void setBusy(boolean busy, JModalInternalFrame blockingIFrame);


    /**
     * <p>Get an indication if the modal component is blocked or not. </p>
     *
     * @return modal status.
     */
    public boolean isBusy();


    /**
     * <p>Add an additional window that should be blocked at the same time as the owner/parent is blocked. </p>
     *
     * @param window Window
     */
    public void addAdditionalModalToWindow(Window window);


    /**
     * <p>Add an additional InputBlocker component that should be blocked at the same time as the owner/parent is blocked. </p>
     *
     * @param inputBlocker InputBlocker
     */
    public void addAdditionalModalToComponent(InputBlocker inputBlocker);


    /**
     * <p>Activate the first window in the chain of blocking windows that isn't busy. </p>
     *
     * @param windowEvent WindowEvent optional window event that triggered this call.
     * @return boolean Indication if the window or one in the chain of blocking windows is activated.
     */
    public boolean activateFirstAvailableBlockingWindow(WindowEvent windowEvent);
}
